﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="GoldenSet.aspx.cs" Inherits="QuerySelectionLabelingTool.GoldenSet" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 129px;
        }
        .style2
        {
            width: 137px;
        }
        .style3
        {
            width: 127px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    Search:
    <asp:TextBox ID="textboxSearch" runat="server" Width="328px"></asp:TextBox>
&nbsp;<asp:Button ID="Button1" runat="server" Text="Search" Width="85px" />
&nbsp;(Search in task ID,task name,news ID, news title,news description)<br />
<br />
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" DataSourceID="SqlDataSourceGoldenset" PageSize="30" 
        Width="916px" ondatabound="GridView1_DataBound">
        <Columns>
            <asp:BoundField DataField="taskID" HeaderText="Task ID" SortExpression="taskID">
            <ItemStyle HorizontalAlign="Center" Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="taskName" HeaderText="Task Name" 
                SortExpression="taskName">
            <ItemStyle HorizontalAlign="Center" Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="newsID" HeaderText="News ID" ReadOnly="True" 
                SortExpression="newsID" >
            <ItemStyle HorizontalAlign="Center" Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="newsTitle" HeaderText="News Title" ReadOnly="True" 
                SortExpression="newsTitle" >
            <ItemStyle Width="80px" />
            </asp:BoundField>
            <asp:BoundField DataField="newsContent" HeaderText="News Content" 
                ReadOnly="True" SortExpression="newsContent" />
            <asp:BoundField DataField="query" HeaderText="Query" ReadOnly="True" 
                SortExpression="query">
            <ItemStyle HorizontalAlign="Center" Width="100px" />
            </asp:BoundField>
        </Columns>
        <EmptyDataTemplate>
            <table border="1" style="width:100%;">
                <tr>
                    <td align="center" class="style1">
                        Task ID</td>
                    <td align="center" class="style2">
                        Task Name</td>
                    <td align="center" class="style3">
                        News ID</td>
                    <td align="center">
                        News Title</td>
                    <td align="center">
                        News Content</td>
                    <td align="center">
                        Query</td>
                </tr>
                <tr>
                    <td align="center" colspan="6">
                        No Result</td>
                </tr>
            </table>
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:SqlDataSource ID="SqlDataSourceGoldenset" runat="server" 
        ConnectionString="<%$ ConnectionStrings:QuerySelectionLabelingToolConnectionString %>" 
        
        
    
        SelectCommand="SELECT TOP (50) tb_task.ID AS taskID, tb_task.name AS taskName, tb_news.ID AS newsID, tb_news.title AS newsTitle, tb_news.newsContent, tb_q.query FROM tb_standardQuery AS tb_q INNER JOIN tb_task ON tb_task.ID = tb_q.taskID INNER JOIN tb_news ON tb_news.ID = tb_q.newsID WHERE (tb_q.taskID IN (SELECT ID FROM tb_task AS tb_task_1 WHERE (ID LIKE '%' + @search + '%') OR (name LIKE '%' + @search + '%'))) OR (tb_q.newsID IN (SELECT ID FROM tb_news AS tb_news_1 WHERE (ID LIKE '%' + @search + '%') OR (title LIKE '%' + @search + '%') OR (newsContent LIKE '%' + @search + '%'))) ORDER BY taskID DESC">
        <SelectParameters>
            <asp:ControlParameter ControlID="textboxSearch" DefaultValue="%" Name="search" 
                PropertyName="Text" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
